package org.rambadger.command.axon;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Annotation to inject {@link org.mongojack.JacksonDBCollection JacksonDBCollection} instances into a resource.
 * <p>
 *     Unfortunately, due to type erasure it is impossible to determine the classes given as type parameters at time. Therefore, it is necessary to specify the types for the mapped class so that we can locate the collection and configure the wrapper.
 * </p>
 * <p>
 *     Annoyingly {@link org.mongojack.MongoCollection @MongoCollection} was already being used, and the name Collection is already taken by a standard class.
 * </p>
 */
@Retention(RUNTIME)
@Target({FIELD, PARAMETER})
public @interface JCollection {
    /**
     * The class that the collection should be mapped to. Must have the {@link org.mongojack.MongoCollection MongoCollection} annotation
     *
     * @return the class to be wrapped
     */
    Class type();

    /**
     * Type of the key to be used by the wrapper, by default {@link String} is used
     *
     * @return the to use for the key
     */
    Class key() default String.class;
}
